<?php
$error = false;
if($this->Session->check('process_error')){
    if($this->Session->read('process_error') == 'yes'){
        $error = true;
    }
    $controller->Session->delete('process_error');
}
?>
<?php
$flash_msg = $this->Session->read('Message');
if(isset($flash_msg['flash'])){
    ?>
    <div class="row-fluid">
        <div class="span12">
            <?php
            if($error){
                echo $this->Message->msg('Status',$this->Session->flash(),'error',true);
            }
            else{
                echo $this->Message->msg('Status',$this->Session->flash(),'success',true);
            }
            ?>
        </div>
    </div>
<?php
}
?>
<div class="row-fluid">

    <div class="span12">
        <?php echo $this->Form->create('Company', array('id' => 'form','class'=>'editprofileform'));?>

        <div class="widgetbox personal-information">
            <h4 class="widgettitle">Company Information</h4>
            <div class="widgetcontent">
                <p>
                    <label>Name:</label>
                    <?php echo $this->Form->input('name', array('id' => 'name', 'class' => 'input-xlarge', 'value' => $company['name'], 'div' => false, 'label' => false)); ?>
                </p>
                <p>
                    <label>Location:</label>
                    <?php echo $this->Form->input('location', array('id' => 'mname', 'class' => 'input-xlarge', 'value' => $company['location'], 'div' => false, 'label' => false)); ?>
                </p>
                <p>
                    <label>Postal Box:</label>
                    <?php echo $this->Form->input('postal_box', array('id' => 'lname', 'class' => 'input-xlarge', 'value' => $company['postal_box'], 'div' => false, 'label' => false)); ?>
                </p>
                <p>
                    <label>Email:</label>
                    <?php echo $this->Form->input('email', array('id' => 'email', 'class' => '', 'default' => $company['email'], 'div' => false, 'label' => false)); ?>
                </p>
                <p>
                    <label>Telephone:</label>
                    <?php echo $this->Form->input('telephone', array('id'=>'telephone', 'value'=>$company['telephone'], 'div' => false, 'label' => false)); ?>
                </p>
                <p>
                    <label>Fax:</label>
                    <?php echo $this->Form->input('fax', array('id'=>'fax', 'value'=>$company['fax'], 'div' => false, 'label' => false)); ?>
                </p>
                <p>
                    <label>Website:</label>
                    <?php echo $this->Form->input('website_address', array('id'=>'website_address', 'value'=>$company['website_address'], 'div' => false, 'label' => false)); ?>
                </p>
            </div>
        </div>

        <p>
            <?php
            if(in_array('E',$permissions)){
            ?>
                <button type="submit" class="btn btn-primary">Update Profile</button> &nbsp;
            <?php
            }
            ?>

            <?php echo $this->Form->input('id', array('type'=>'hidden','id'=>'id', 'value'=>$company['id'], 'div' => false, 'label' => false)); ?>
        </p>

        <?php echo $this->Form->end();?>
    </div><!--span8-->
</div><!--row-fluid-->

<!-- URLs -->
<input type="hidden" id="company_save_url" value="<?php echo $this->Html->url(array('controller' => 'Admin', 'action' => 'company')); ?>" />

<!-- Le Script -->
<?php
    echo $this->Html->script('scripts/admin/company.js');
?>
